package lexer

import (
	"unicode"
	"unicode/utf8"
)

func isLetter(ch rune) bool {
	return 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '_' || ch >= utf8.RuneSelf && unicode.IsLetter(ch)
}

func isDigit(ch rune) bool {
	return '0' <= ch && ch <= '9' || ch >= utf8.RuneSelf && unicode.IsDigit(ch)
}

func digitVal(ch rune) int {
	switch {
	case '0' <= ch && ch <= '9':
		return int(ch - '0')
		//case 'a' <= ch && ch <= 'f':
		//	return int(ch - 'a' + 10)
		//case 'A' <= ch && ch <= 'F':
		//	return int(ch - 'A' + 10)
	}
	return 10 // larger than any legal digit val
}
